package com.xunmaw.supermarket.service.provider;

import com.xunmaw.supermarket.dao.ProviderDao;
import com.xunmaw.supermarket.pojo.Provider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 功能说明
 */
@Transactional(propagation = Propagation.REQUIRED, rollbackForClassName = "Exception")
@Service
public class ProviderServiceImpl implements ProviderService {
	
	@Autowired
	private ProviderDao providerDao;
	
	public ProviderServiceImpl() {
	}
	
	@Override
	public boolean add(Provider provider) {
		int j = providerDao.add(provider);
		return j > 0 ? true : false;
	}
	
	@Override
	public List<Provider> getProviderList(String proName, String proCode) {
		return providerDao.getAllProvider(proName, proCode);
	}
	
	@Override
	public int deleteProviderById(String delId) {
		return providerDao.delete(delId);
	}
	
	@Override
	public Provider getProviderById(String id) {
		return providerDao.getProviderById(id);
	}
	
	@Override
	public boolean modify(Provider provider) {
		return providerDao.modify(provider) > 0 ? true : false;
	}
 
}
